var Main = {
	data() {
		 var validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入密码'));
        } else {
          if (this.form1.checkPass !== '') {
            this.$refs.form1.validateField('checkPass');
          }
          callback();
        }
      };
      var validatePass2 = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请再次输入密码'));
        } else if (value !== this.form1.newPass) {
          callback(new Error('两次输入密码不一致!'));
        } else {
          callback();
        }
      };
      return {
        form1: {
         oldPass: '',
         newPass: '',
         checkpass:''
        },
        rules: {
          newPass: [
            { validator: validatePass, trigger: 'blur' }
          ],
          checkPass: [
            { validator: validatePass2, trigger: 'blur' }
          ]
      },
        form2: {
          userName: 'feiyu',
          radio:'1',
          phone:1377556543,
          mail:'211212@qq.com'
        },
        form3:{
        	
        },
        form4:{
        	radio:'0'
        },
        visible_password:true,
        visible_personal:false,
        visible_head:false,
        visible_role:false
      }
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      handleSelect(key,keyPath){
      	if(key==1){
      		this.visible_password=true;
      	   this.visible_personal=false;
      	   this.visible_head=false;
      	   this.visible_role=false;
      	}else if(key==2){
      		this.visible_password=false;
      	   this.visible_personal=true;
      	   this.visible_head=false;
      	   this.visible_role=false;
      	}else if(key==3){
      		this.visible_password=false;
      	   this.visible_personal=false;
      	   this.visible_head=true;
      	   this.visible_role=false;
      	}else if(key==4){
      		this.visible_password=false;
      	   this.visible_personal=false;
      	   this.visible_head=false;
      	   this.visible_role=true;
      	}else{
      		
      	}
      }
    }
  }
var Ctor = Vue.extend(Main)
new Ctor().$mount('div')


